import request from '@/utils/request'

export function fetchList(query) {
  return request({
    url: '/admin/goods/index',
    method: 'GET',
    params: query
  })
}
export function fetchOne(id) {
  return request({
    url: '/admin/goods/detail',
    method: 'GET',
    params: { goods_id: id }
  })
}
export function updateOne(data) {
  return request({
    url: '/admin/goods/update',
    method: 'post',
    data
  })
}
export function createOne(data) {
  return request({
    url: '/admin/goods/create',
    method: 'POST',
    data
  })
}
export function deleteOne(id) {
  return request({
    url: '/admin/goods/delete',
    method: 'DELETE',
    params: {
      id: id
    }
  })
}

export function fetchDetailByID(id) {
  return request({
    url: '/index/goods/detail',
    method: 'get',
    params: { goods_id: id }
  })
}
export function fetchShopList(query) {
  return request({
    url: '/index/goods/index',
    method: 'get',
    params: query
  })
}
export function getGoodsCategory() {
  return request({
    url: '/index/goods/category',
    method: 'GET'
  })
}
